<?php

require './Configs/config.php';



// 自动加载类
function mvc_autoload($classname)
{
    // echo $classname.'<br>';
    if (file_exists("./Model/{$classname}.class.php")) {
        require "./Model/{$classname}.class.php";
    } elseif (file_exists("./Controller/{$classname}.php")) {
        require "./Controller/{$classname}.php";
    } else {
        header("HTTP/1.0 404 not found");
        echo '<h1>404 Not Found 入口文件</h1>';
        exit;
    }
}

// 导入smarty模版引擎
require './libs/Smarty.class.php';
// 注册给定的函数作为 __autoload 的实现
spl_autoload_register('mvc_autoload');



$c = (!empty($_GET['c']))?$_GET['c']:'Index';
$a = (!empty($_GET['a']))?$_GET['a']:'index';


$classname = $c.'Controller';

$controller = new $classname;

$controller->$a();